package org.smile.tomcat.session.redis;

import java.io.IOException;

import javax.servlet.ServletException;

import org.apache.catalina.connector.Request;
import org.apache.catalina.connector.Response;
import org.apache.catalina.valves.ValveBase;

public class RedisSessionHandleValve extends ValveBase {
	/**持有一个sessionmanager的引用*/
	private RedisManager manager;

	public void setRedisSessionManager(RedisManager manager) {
		this.manager = manager;
	}

	@Override
	public void invoke(Request request, Response response) throws IOException, ServletException {
		try {
			getNext().invoke(request, response);
		} finally {
			manager.afterRequest();
		}
	}
}
